#!/usr/bin/env python
# encoding: utf-8
'''
@author: qiuyan
@contact: winston@peipeiyun.com
@file: application.py
@time: 2019/1/4 4:25 PM
@desc:
'''
import os
import pymysql
pymysql.install_as_MySQLdb()
from tornado import web
from core.error import NotFoundHandler
from core.route import handlers
from conf import conf

static_path = os.path.join(os.getcwd(),'..',conf.app.app_static)
settings = {
        'static_path': static_path,
        'template_path': static_path,
        "cookie_secret": "p4Qy1mcwQJiSOAytobquL3YDYuXDkkcYobmUWsaBuoo",
        'xsrf_cookies': False,
        'debug': False,
        "gzip" : True
    }

class Application(web.Application):
    def __init__(self):
        _settings = dict(
            debug=conf.debug,
            autoreload=conf.debug,
            default_handler_class=NotFoundHandler,
            compress_response=False
        )
        settings.update(**_settings)
        super(Application, self).__init__(handlers, **settings)
